package org.apache.solr.ocean.replication;

import java.io.File;

import org.apache.solr.ocean.util.Timeout;
import org.apache.solr.ocean.util.XMLUtil;
import org.jdom.Element;

public class FileCell extends Cell {
  private String masterNodeId;
  
  public static FileCell load(File file) throws Exception {
    Element element = XMLUtil.parseElement(file);
    return new FileCell(element);
  }
  
  public FileCell(Element element) {
    masterNodeId = XMLUtil.getChildText("masterNodeId", element);
  }
  
  public void notifySlaveNotInSync(String masterNodeId, String nodeIdLease) {
    
  }
  
  public String voteOnMaster(Timeout timeout) {
    return masterNodeId;
  }
  
  public String getAgreedMaster(Timeout timeout, boolean useCache) {
    return masterNodeId;
  }
  
  public boolean isMaster(String nodeId) {
    return masterNodeId.equals(nodeId);
  }
  
  public void notifyLeaseCancellation(String masterNodeId, String nodeIdLease) {
    
  }
  
  public void notifyMasterFailure(String masterNodeId) {
    
  }
  
  public void registerListener(Listener cellListener) {
    
  }
  
  
}
